<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
  <meta charset="UTF-8">
  <title>Menu - Basic</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
  <link href="../../../../../css/ionic.bundle.css" rel="stylesheet">
  <link href="../../../../../scripts/testing/styles.css" rel="stylesheet">
  <script src="../../../../../scripts/testing/scripts.js"></script>
  <script nomodule src="../../../../../dist/ionic/ionic.js"></script>
  <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
  <script>
    const forceCSSAnimations = new URLSearchParams(window.location.search).get('ionic:_forceCSSAnimations');
    if (forceCSSAnimations) {
      window.Animation = null;
    }
  </script>
  <script type="module">
    import { menuController } from '../../../../dist/ionic/index.esm.js';
    window.menuController = menuController;
  </script>
</head>

<body>
  <ion-app>
    <ion-menu side="start" menu-id="first" id="start-menu" content-id="main" class="menu-part">
      <ion-header>
        <ion-toolbar color="primary">
          <ion-title>Start Menu</ion-title>
        </ion-toolbar>
      </ion-header>
      <ion-content>
        <ion-list>
          <ion-item>Menu Item</ion-item>
          <ion-item>Menu Item</ion-item>
          <ion-item>Menu Item</ion-item>
          <ion-item>Menu Item</ion-item>
          <ion-item>Menu Item</ion-item>
        </ion-list>
      </ion-content>
    </ion-menu>

    <ion-menu side="start" menu-id="custom" class="my-custom-menu" id="custom-menu" content-id="main">
      <ion-header>
        <ion-toolbar color="tertiary">
          <ion-title>Custom Menu</ion-title>
        </ion-toolbar>
      </ion-header>
      <ion-content>
        <ion-list>
          <ion-item>Menu Item</ion-item>
          <ion-item>Menu Item</ion-item>
          <ion-item>Menu Item</ion-item>
          <ion-item>Menu Item</ion-item>
          <ion-item>Menu Item</ion-item>
        </ion-list>
      </ion-content>
    </ion-menu>

    <ion-menu side="end" type="push" id="end-menu" content-id="main">
      <ion-header>
        <ion-toolbar color="danger">
          <ion-title>End Menu</ion-title>
        </ion-toolbar>
      </ion-header>
      <ion-content>
        <ion-list>
          <ion-item>Menu Item</ion-item>
          <ion-item>Menu Item</ion-item>
          <ion-item>Menu Item</ion-item>
          <ion-item>Menu Item</ion-item>
          <ion-item>Menu Item</ion-item>
        </ion-list>
      </ion-content>
    </ion-menu>

    <div class="ion-page" id="main">
      <ion-header>
        <ion-toolbar>
          <ion-title>Menu - Basic</ion-title>
        </ion-toolbar>
      </ion-header>
      <ion-content class="ion-padding">
        <ion-button expand="block" onclick="openFirst()">Open Start Menu</ion-button>
        <ion-button expand="block" onclick="openEnd()">Open End Menu</ion-button>
        <ion-button expand="block" onclick="openCustom()">Open Custom Menu</ion-button>
      </ion-content>
    </div>

  </ion-app>

  <style>
    .my-custom-menu {
      --width: 500px;
    }

    .menu-part::part(backdrop) {
      background-color: rgba(255, 0, 255, 0.5);
    }

    .menu-part::part(container) {
      border-radius: 0 20px 20px 0;

      box-shadow: 4px 0px 16px rgba(255, 0, 255, 0.18);
    }
  </style>

  <script>
    async function openFirst() {
      await menuController.enable(true, 'first');
      await menuController.open('first');
    }

    async  function openEnd() {
      await menuController.open('end');
    }

    async function openCustom() {
      await menuController.enable(true, 'custom');
      await menuController.open('custom');
    }
  </script>
</body>

</html>
